// pages/registerOA/registerOA.js
let app = getApp();
import { serverIp } from '../../utils/util'; 
Page({

  /**
   * 页面的初始数据
   */
  data: {
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },

  formSubmit: function (e) {

    wx.request({
      url: serverIp + '/api/user/insert',
      method: 'POST',
      data: {
        openId: app.globalData.userInfo.openId,
        ...e.detail.value 
      },
      success: (res) => {
        if (res.data.success) {
          wx.switchTab({
            url: '/pages/index/index'
          });
        }
      }
    });
  }
})